package org.HU.train.business.controller.member;

import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.HU.train.business.req.daily.DailyTrainTicketQueryReq;
import org.HU.train.business.resp.daily.DailyTrainTicketQueryResp;
import org.HU.train.business.service.daily.DailyTrainTicketService;
import org.HU.train.common.response.CommonResp;
import org.HU.train.common.response.PageResp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author ZUZ
 * @Description: 用户查询火车票的接口
 * @Date 2024-12-22 14:49
 * @ClassName: DailyTrainController
 */
@RestController
@RequestMapping("/daily-train-ticket")
public class DailyTrainTicketController {

    @Resource
    private DailyTrainTicketService dailyTrainTicketService;

    /**
     * 可以根据车次、日期、始发站、终点站查询余票信息
     * 用redis做缓存处理
     */
    @GetMapping("/query-list")
    public CommonResp<PageResp<DailyTrainTicketQueryResp>> queryList(@Valid DailyTrainTicketQueryReq req) {
        PageResp<DailyTrainTicketQueryResp> list = dailyTrainTicketService.queryList(req);
        return new CommonResp<>(list);
    }

}